cmake_minimum_required(VERSION 3.10)
project(Game LANGUAGES C CXX VERSION 1.0.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (MSVC)
    # 全局设置（适用于所有编译器，但 MSVC 会忽略不支持的选项）
    add_compile_options(/utf-8)
endif ()
find_package(SDL3 CONFIG REQUIRED PATHS "F:/libs/SDL3-devel-3.2.0-VC/SDL3-3.2.0" NO_DEFAULT_PATH)
find_package(SDL3_image CONFIG REQUIRED PATHS "F:/libs/SDL3_image-devel-3.2.0-VC/SDL3_image-3.2.0" NO_DEFAULT_PATH)
find_package(SDL3_ttf CONFIG REQUIRED PATHS "F:/libs/SDL3_ttf-devel-3.2.0-VC/SDL3_ttf-3.2.0" NO_DEFAULT_PATH)
find_package(SDL3_mixer CONFIG REQUIRED PATHS "F:/libs/SDL3_mixer" NO_DEFAULT_PATH)
find_package(glm CONFIG REQUIRED PATHS "F:/libs/glm" NO_DEFAULT_PATH)
add_executable(Game
        src/core/game.cpp
        src/core/game.h
        src/main.cpp
        src/scene_main.cpp
        src/scene_main.h
        src/core/object_world.cpp
        src/core/object_world.h
        src/player.cpp
        src/player.h
        src/core/scene.cpp
        src/core/scene.h
        src/core/resource_store.cpp
        src/core/resource_store.h
        src/core/object.cpp
        src/core/object.h
        src/core/object_affiliate.cpp
        src/core/object_affiliate.h
        src/core/actor.cpp
        src/core/actor.h
        src/core/object_screen.h
        src/core/defs.h
        src/affiliate/sprite.cpp
        src/affiliate/sprite.h
        src/affiliate/sprite_anim.cpp
        src/affiliate/sprite_anim.h
        src/enemy.cpp
        src/enemy.h
        src/affiliate/collider.cpp
        src/affiliate/collider.h
        src/raw/stats.cpp
        src/raw/stats.h
        src/world/effect.cpp
        src/world/effect.h
        src/spawner.cpp
        src/spawner.h
        src/screen/ui_mouse.cpp
        src/screen/ui_mouse.h
        src/world/spell.cpp
        src/world/spell.h
        src/raw/weapon.cpp
        src/raw/weapon.h
        src/weapon_thunder.cpp
        src/weapon_thunder.h
        src/affiliate/affiliateBar.cpp
        src/affiliate/affiliateBar.h
        src/screen/hud_stats.cpp
        src/screen/hud_stats.h
        src/screen/hub_skill.cpp
        src/screen/hud_skill.h
        src/affiliate/text_label.cpp
        src/affiliate/text_label.h
        src/screen/hud_text.cpp
        src/screen/hud_text.h
        src/scene_title.cpp
        src/scene_title.h
        src/screen/hud_button.cpp
        src/screen/hud_button.h
        src/raw/timer.cpp
        src/raw/timer.h
        src/raw/bg_star.cpp
        src/raw/bg_star.h
)
target_link_libraries(Game PRIVATE SDL3::SDL3 glm::glm SDL3_image::SDL3_image SDL3_ttf::SDL3_ttf SDL3_mixer::SDL3_mixer)
if (WIN32)
    add_custom_command(TARGET Game POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
            "$<TARGET_FILE:SDL3::SDL3>"
            $<TARGET_FILE_DIR:Game>
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
            "$<TARGET_FILE:SDL3_image::SDL3_image>"
            $<TARGET_FILE_DIR:Game>
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
            "$<TARGET_FILE:SDL3_ttf::SDL3_ttf>"
            $<TARGET_FILE_DIR:Game>
            COMMAND ${CMAKE_COMMAND} -E copy_if_different
            "$<TARGET_FILE:SDL3_mixer::SDL3_mixer>"
            $<TARGET_FILE_DIR:Game>
    )
endif (WIN32)

add_custom_command(TARGET Game POST_BUILD
        COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different
        "${CMAKE_SOURCE_DIR}/resources" "$<TARGET_FILE_DIR:Game>/resources"
)